 ;
var account_set_ops={
    init:function () {
        console.log("edit.js页面开始工作了。。。。。")
        this.eventBind();
    },
    //时间绑定
    eventBind:function () {
        console.log("edit.js.eventBind函数开始工作了。。。。。")
        $(".wrap_account_set .save").click(function () {//点击按钮执行click方法，方法内执行事件
            console.log("点击得到相应了。。。。。")
            var btn_target = $(this);//当前对象
            if (btn_target.hasClass("disabled")) {
                common_ops.alert("正在处理，请不要重复提交！");
                return;
            }
            //获取输入对象
            var nickname_target = $(".wrap_account_set input[name=nickname]");
            var nickname = nickname_target.val();

            var email_target = $(".wrap_account_set input[name=email]");
            var email = email_target.val();

            var mobile_target = $(".wrap_account_set input[name=mobile]");
            var mobile = mobile_target.val();

            var login_name_target = $(".wrap_account_set input[name=login_name]");
            var login_name = login_name_target.val();

            var login_pwd_target = $(".wrap_account_set input[name=login_pwd]");
            var login_pwd = login_pwd_target.val();

            if (nickname.length < 1) {
                common_ops.tip("请输入符合规范的姓名~~", nickname_target);
                return false;
            }
            if (email.length < 1) {
                common_ops.tip("请输入符合规范的邮箱~~", email_target);
                return false;
            }
            if (mobile.length < 1) {
                common_ops.tip("请输入符合规范的手机号~~", mobile_target);
                return false;
            }

            if (login_name.length < 1) {
                common_ops.tip("请输入符合规范的登录名~~", login_name_target);
                return false;
            }

            if (login_pwd.length < 6) {
                common_ops.tip("请输入符合规范的登录密码~~", login_pwd_target);
                return false;
            }

            btn_target.addClass("disabled");//禁掉按钮，提交成功以后才能展示出

            var data = {
                nickname:nickname,
                email:email,
                mobile:mobile,
                login_name:login_name,
                login_pwd:login_pwd,
                id: $(".wrap_account_set input[name=id]").val()
            };
            $.ajax({
                url:common_ops.buildUrl('/account/set'),
                type:'POST',
                data:data,
                dataType:'json',
                success:function (res) {
                     //请求得到响应以后去掉disabled
                    btn_target.removeClass("disabled");
                    var callback = null;
                    if(res.code == 200)
                    {
                        callback=function () {
                            window.location.href = common_ops.buildUrl('/account/index');//页面跳转
                        }
                    }

                    common_ops.alert(res.msg, callback);
                },
                error:function (res,err) {
                    console.log(err);
                }
            })
        });
    },
};
//当页面jquery加载完以后执行
$(document).ready(function () {
    account_set_ops.init();
});